﻿
using System;
using System.Collections.Generic;


namespace SDService.Model.DTO
{
    [Serializable]
    public class FunctionEntity
    {

        public string AppId { get; set; }

        /// <summary>
        /// 应用/功能/页面/权限ID号
        /// </summary>
        public string AppCode { get; set; }

        /// <summary>
        /// 父编号
        /// </summary>
        public string Parent { get; set; }
        /// <summary>
        /// 要显示的标题
        /// </summary>
        public string Title { get; set; }

        public string ImagePath { get; set; }


        /// <summary>
        /// 提示语
        /// </summary>
        public FunctionTip Tip { get; set; }

        /// <summary>
        /// 是否隐藏 1是0否
        /// </summary>
        public FunctionItemStatus Status { get; set; }

        /// <summary>
        /// 子功能
        /// </summary>
        public List<FunctionEntity> Items { get; set; }

        /// <summary>
        /// 控件所在DLL与类信息
        /// </summary>
        public ClassInfo ClassInfo { get; set; }

        /// <summary>
        /// 菜单执行类型 
        /// </summary>
        public FunctionType FunctionType { get; set; }

        /// <summary>
        /// 加载时是否执行
        /// </summary>
        public bool StartLoad { get; set; }
        /// <summary>
        /// 设置此项为true,主窗体加载此项为首页,注:只有在本菜单为FunctionType.Control是生效
        /// </summary>
        public bool Index { get; set; }

        /// <summary>
        /// 菜单项类型  如FucntionItemType.Group|FucntionItemType.Item
        /// </summary>
        public FunctionItemType ItemType
        {
            get;
            set;
        }

        /// <summary>
        /// 快捷键
        /// </summary>
        public int HotKey
        {
            get;
            set;
        }

        /// <summary>
        /// 是否创建菜单项 
        /// </summary>
        public bool IsCreate
        {
            get;
            set;
        }

        /// <summary>
        /// 刷新数据参数
        /// </summary>
        public object ItemParamter
        {
            get;
            set;
        }

        /// <summary>
        /// 是否重新加载页面
        /// </summary>
        public bool IsReload
        {
            get;
            set;
        }
        /// <summary>
        /// 备注
        /// </summary>
        public string Remarks
        {
            get;
            set;
        }

        /// <summary>
        /// 是否启用
        /// </summary>
        public bool Enabled { get; set; }

        public FunctionEntity()
        {
            ItemType = FunctionItemType.Group;
            FunctionType = FunctionType.Control;
            IsCreate = true;
            Enabled = true;
        }


    }

    public class ClassInfo
    {
        public string DLLName { get; set; }
        public string ClassFillName { get; set; }
    }

    public class FunctionTip
    {
        public string Title { get; set; }
        public string Text { get; set; }


    }

    /// <summary>
    /// 菜单执行方法的类型
    /// </summary>
    public enum FunctionType
    {
        /// <summary>
        /// 这是一个应用
        /// </summary>
        App = 1,
        /// <summary>
        /// 创建或加载控件
        /// </summary>
        Control = 2,

        /// <summary>
        /// 执行自定义函数
        /// </summary>
        Function = 4,

        /// <summary>
        /// 表示当前节点只是一个权限点 
        /// </summary>
        Authorization = 8
    }

    /// <summary>
    /// 菜单项类型
    /// </summary>
    public enum FunctionItemType
    {
        /// <summary>
        /// 分组
        /// </summary>
        Group = 1,
        /// <summary>
        /// 项
        /// </summary>
        Item = 2
    }

    /// <summary>
    /// 项目显示状态
    /// </summary>
    public enum FunctionItemStatus
    {
        Enable = 1,
        Disable = 2,
        Hide = 3
    }
}
